document.addEventListener('DOMContentLoaded', function() {
    const container = document.querySelector('.image-container');
    const images = container.querySelectorAll('img');
    const imageWidth = 247.21 + 15; 
    let currentPosition = 0;
    const firstTwoImages = Array.from(images).slice(0, 2);
    firstTwoImages.forEach(img => {
        const clone = img.cloneNode(true);
        container.appendChild(clone);
    });
    function moveCarousel() {
        currentPosition++;
        if (currentPosition >= images.length) {
   
            container.style.transition = 'none';
            currentPosition = 0;
            container.style.transform = `translateX(0)`;
            
            container.offsetHeight;
         
            container.style.transition = 'transform 0.5s ease';
        } else {
            container.style.transform = `translateX(-${currentPosition * imageWidth}px)`;
        }
    }

    setInterval(moveCarousel, 3000);
});